<!--
Template Name: mixDialog
Create author: qinglong
Create Time  : 2021-01-20
-->
<template>
  <el-dialog width="400px" v-bind="$attrs" v-on="$listeners" :show-close="true" append-to-body @close="onClose">
    <template slot="title">
      <div class="header">
        {{$attrs.title}}
      </div>
    </template>
    <slot></slot>
    <template slot="footer">
      <div class="footer">
        <el-button round style="width:100%" @click="cancel" v-if="$listeners.cancel">{{$attrs.cancelText||'取消'}}</el-button>
        <el-button round style="width:100%" type="primary" @click="confirm" v-if="$listeners.confirm">{{$attrs.confirmText||"保存"}}</el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script>
export default {
  name: 'mixDialog',

  methods: {
    input(a) {
      console.log(a);
      this.$emit('input', {});
    },
    async confirm() {
      this.$emit('confirm');
    },
    cancel() {
      this.$emit('cancel');
    },
    onClose() {
      this.$emit('update:cisible', false);
    },
  },
};
</script>
<style lang="less" scoped>
.header {
  height: 40px;
  border-bottom: 1px solid #ccc;
}
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style>